home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2228 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: bcfreenet.seflin.lib.fl.us!bcfreenet!z007400b
  2. From: z007400b@bcfreenet.seflin.lib.fl.us (Ralph Silverman)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Segmentation fault at return statement. Can't figure out ....
  5. Date: 19 Jan 1996 18:47:36 GMT
  6. Organization: SEFLIN Free-Net - Broward
  7. Message-ID: <4dop08$kdi@bcfreenet.seflin.lib.fl.us>
  8. References: <4dm2n1$egk@murphy.servtech.com>
  9. NNTP-Posting-Host: bcfreenet.seflin.lib.fl.us
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Avijit Dasgupta (avi@servtech.com) wrote:
  13. : Hi all,
  14.  
  15. : I am not being able to figure out why I get a segmentation fault in 
  16. : a return stmt. 
  17.  
  18. : main.c:
  19.  
  20. : main()
  21. : {
  22. : ..
  23. : ..
  24. :  calls a function test() returning int
  25.  
  26. : }
  27.  
  28. : test.c:
  29.  
  30. : test()
  31. : {
  32.  
  33. : .
  34. : ..
  35. : .
  36. : 83: return(999); <----- Segmentation fault at this stmt.
  37. : }
  38.  
  39. : Running dbx I get these error messages:
  40.  
  41. : (dbx) where
  42. : => [1] test( ) at line 83
  43. : dbx: bad data address
  44. : dbx fetch at 0x697075a4 failed - I/O error
  45. : dbx : attempt to read stack failed - bad frame pointer
  46. : (dbx)
  47.  
  48. : I can't figure out, bcoz this function gets called multiple times and
  49. : fails only after a fixed X times ... Any Help ? 
  50.  
  51.  
  52. --
  53. ********begin r.s. response*********
  54.  
  55.     'test'
  56.     is likely to be
  57.     a command of
  58.     the
  59.         operating system
  60.     .
  61.     1)    look it up.
  62.     2)    rename yours.
  63.  
  64.  
  65. ********end r.s. response***********
  66. Ralph Silverman
  67. z007400b@bcfreenet.seflin.lib.fl.us
  68.  
  69.